import 'dart:ui';

import 'package:super_study_english_tool/model/model_user_album_media.dart';
import 'package:flutter/material.dart';

import '../screen/screen_player.dart';

class WidgetAlbumMedia extends StatefulWidget {
  const WidgetAlbumMedia({super.key, required this.media, required this.onPressed, required this.onBack});

  final ModelUserAlbumMedia media;

  final ValueChanged<int> onPressed;

  final ValueChanged<int> onBack;

  @override
  State<WidgetAlbumMedia> createState() => _WidgetAlbumMediaState();
}

class _WidgetAlbumMediaState extends State<WidgetAlbumMedia> {
  @override
  Widget build(BuildContext context) {
    return Row(
      mainAxisAlignment: MainAxisAlignment.spaceAround,
      children: [
        Text(widget.media.fileName!),
        Text("句子数:${widget.media.sentenceQty ?? 0}"),
        Text("完成数:${widget.media.finishQty ?? 0}"),
        Text("忽略数:${widget.media.ignoreQty ?? 0}"),
        Text("待复习数:${widget.media.reviewQty ?? 0}"),
        Text("单词量:${widget.media.wordQty ?? 0}"),
        Text("语速:${widget.media.speed ?? 0}"),
        TextButton(
            onPressed: () {
              print("学习");
              print(widget.media.filePath);

              Widget w = ScreenPlayer(
                mode: 1,
                // mp4Path: widget.media.filePath,
                media: widget.media,
                // srtPath1: "/Users/qiang/英语/译林英语/4上/4上4.srt",
              );

              Navigator.of(context).push(MaterialPageRoute(builder: (context) {
                return w;
              })).then((value) {
                print("back!!");
                widget.onBack(0);
              });
            },
            child: Text("学习"))
      ],
    );
  }
}
